const mongoose = require('mongoose')

const url = 'mongodb://47.93.60.75:27017'
const dbName = 'zhufeng' // 数据库名称

// 开始连接
mongoose.connect(`${url}/${dbName}`, {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    user: "zf",
    pass: "zf"
})

// 连接对象
const db = mongoose.connection

db.on('error', err => {
    console.error('mongoose connect error', err)
})

module.exports = mongoose

